package common.service.util;

import common.service.base.common.ReqVo;
import common.service.base.exception.MobileException;
import common.service.contants.MobileConfig;
import org.apache.commons.lang3.StringUtils;

/**
 * @ClassName checkParamUtils
 * @Description Todo
 * @Author yanghao
 * @Date 2018/9/4 下午2:48
 * Version 0.0.1
 **/
public class CheckParamUtils {


    public static String checkParamNullReturnValue(ReqVo reqVo,String name){
        String value = (String) reqVo.getValue(name);
        if(StringUtils.isBlank(value)){
            throw new MobileException(MobileConfig.MOBILE_STATUS_PARAM_NULL,MobileConfig.MOBILE_MSG_PARAM_NULL+name);
        }
        return value;
    }

    public static Long checkParamNullReturnLongValue(ReqVo reqVo,String name){
        Integer value = (Integer) reqVo.getValue(name);
        if(value==null){
            throw new MobileException(MobileConfig.MOBILE_STATUS_PARAM_NULL,MobileConfig.MOBILE_MSG_PARAM_NULL+name);
        }
        return value.longValue();
    }

}